<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>2.Set元素检测与管理</title>
</head>
<body>
  <script>
    let set = new Set('hdcms');
    console.log(set); //Set(5) {'h', 'd', 'c', 'm', 's'} ,类似扩展语法[ ...'hdcms '']
    console.log([...'hdcms']);// (5)['h', 'd', 'c', 'm', 's'] 

    set = new Set(['hdcms','houdunren']);
    console.log(set.size); // 2 数量
    // 判断元素是否存在
    console.log(set.has("hdcms.cn")); // false
    console.log(set.delete("hdcms")); // 删除元素 ，成功返回true
    console.log(set);//Set(1) {'houdunren'}
    console.log(set.clear()); // undeifne 没有返回值，clear必定成功
    console.log(set.size); // 0 被clear的set，数量为0
  </script>
  
</body>
</html>